<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class ValRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'title' => 'required',
            'content' => 'required',
            'author' => 'required',
            'apply_person' => 'required',
            'illness_type' => 'required',
            'measure' => 'required',
            'method' => 'required',
            'drug' => 'required',
            'attention' => 'required',
        ];
    }

    public function messages()
    {
        return [
            'title.required' =>'科普标题必填',
            'content.required' => '科普内容必填',
            'author.required' => '发布者必填',
            'apply_person.required' => '适用人群必填',
            'illness_type.required' => '疾病类型必填',
            'measure.required' => '预防措施必填',
            'method.required' => '治疗方法必填',
            'drug.required' => '药品推荐必填',
            'attention.required' => '注意事项必填',
        ];
    }
}
